import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
driver=webdriver.Chrome()
driver.maximize_window()
driver.implicitly_wait(10)
driver.get("http://localhost/")
driver.find_element_by_css_selector("[class='red'] ").click()
driver.find_element_by_id("username").send_keys("15837321720")
driver.find_element_by_name("password").send_keys("123456")
driver.find_element_by_css_selector("[class='text_uspa check_cum']>[class='text_cmu']").send_keys("8888")
driver.find_element_by_xpath("//div[@class='login_bnt']/a[@class='J-login-submit']").click()
time.sleep(3)
driver.find_element(By.CSS_SELECTOR,"[href='/Home/Index/index.html']").click()
driver.find_element(By.ID,"q").send_keys("珠宝")
driver.find_element(By.CSS_SELECTOR,"[class='ecsc-search-button']").click()
driver.find_element(By.XPATH,"//div[@class='xs_img']/a/img").click()
driver.find_element(By.CSS_SELECTOR,"#join_cart_now").click()
time.sleep(5)
driver.find_element(By.CSS_SELECTOR,"[class='address_id'] [name='address_id']").click()
js="window.scrollTo(0,200)"
driver.execute_script(js)
select=Select(driver.find_element(By.CSS_SELECTOR,"[name='shipping_code']"))
select.select_by_visible_text("顺丰物流")
driver.find_element(By.CSS_SELECTOR,"[class='Sub-orders gwc-qjs']").click()
driver.find_element(By.CSS_SELECTOR,"[src='/plugins/payment/cod/logo.jpg']").click()
driver.find_element(By.CSS_SELECTOR,"[class='button-style-5 button-confirm-payment']").click()
time.sleep(3)
driver.find_element(By.CSS_SELECTOR,"[class='ddxq-xiaq']>a").click()
time.sleep(3)
js="window.scrollTo(0,500)"
driver.execute_script(js)
time.sleep(3)
driver.quit()
